package CPU;

//CPU类
class CPU {
 private int speed; // CPU速度

 public int getSpeed() {
     return speed;
 }

 public void setSpeed(int m) {
     this.speed = m;
 }
}

//HardDisk类
class HardDisk {
 private int amount; // 硬盘容量

 public int getAmount() {
     return amount;
 }

 public void setAmount(int m) {
     this.amount = m;
 }
}

//PC类
class PC {
 private CPU cpu;
 private HardDisk HD;

 public void setCPU(CPU c) {
     this.cpu = c;
 }

 public void setHardDisk(HardDisk h) {
     this.HD = h;
 }

 public void show() {
     System.out.println("CPU速度：" + cpu.getSpeed());
     System.out.println("硬盘容量：" + HD.getAmount());
 }
}

//主类，Test
public class Test{
public static void main(String[] args){
   // 创建CPU对象，设置speed为2200
   CPU cpu = new CPU();
   cpu.setSpeed(2200);

   // 创建HardDisk对象，设置amount为200
   HardDisk disk = new HardDisk();
   disk.setAmount(200);

   // 创建PC对象
   PC pc = new PC();

   // 设置PC的CPU和硬盘
   pc.setCPU(cpu);
   pc.setHardDisk(disk);

   // 显示PC的CPU速度和硬盘容量
   pc.show();
}
}
